package org.xiaoleng.cdm.connections;

import com.alibaba.fastjson2.JSONObject;
import lombok.Getter;
import lombok.Setter;
import org.xiaoleng.cdm.datasources.Datasource;

import java.util.List;
import java.util.function.Function;

@Getter
@Setter
public abstract class DatabaseConnection {
    private Datasource datasource;

    public abstract int read(Function<List<JSONObject>, Integer> function);

    public abstract int write(List<JSONObject> jsons);

    public abstract void close();

    public DatabaseConnection(Datasource datasource) {
        this.datasource = datasource;
    }
}
